﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////

#pragma once

#include "GcmpCommandAction.h"

namespace gcmp
{
    class IGraphicsNodeGroup;
    class Intervald;
    class ITemporaryDimensionContext;
}

namespace gcmp
{
    /// \brief 临时尺寸标注处理器
    class GCMP_COMMAND_ACTION_EXPORT ITemporaryDimensionHandler
    {
    public:
        virtual ~ITemporaryDimensionHandler() {}

    public:

        /// \brief 生成临时标注显示的图形表达
        /// \param pTemporaryDimensionContext 生成临时尺寸标注的几何数据
        /// \return 临时标注显示的图形表达
        /// \see ITemporaryDimensionContext
        virtual gcmp::OwnerPtr<gcmp::IGraphicsNodeGroup> GenerateGraphics(const ITemporaryDimensionContext* pTemporaryDimensionContext) = 0;

        /// \brief 是否处于输入状态
        /// \return bool 若处于输入状态，则返回true；否则返回false
        virtual bool IsInInputState() const = 0;

        /// \brief 输入框是否可编辑
        /// \return bool 输入框可编辑，返回true；否则返回false
        virtual bool IsInputWidgetEditable() const = 0;

        /// \brief 撤消输入状态, 隐藏输入框
        /// \return void
        virtual void HideInputWidget() = 0;

        /// \brief 提交输入, 并隐藏输入框
        /// \return void
        virtual void OnEditorReturnPressed() = 0;

        /// \brief 唤醒
        /// \param key 键值
        /// \param isCtrlPressed Ctrl键是否按下
        /// \param isAltPressed Alt键是否按下
        /// \param isShiftPressed Shift键是否按下
        /// \return bool 临时尺寸标注处理器是否响应了该事件
        virtual bool WakeOn(int key, bool isCtrlPressed , bool isAltPressed, bool isShiftPressed) = 0;

        /// \brief 更新配置
        /// \param pTemporaryDimensionContext 生成临时尺寸标注的配置数据
        /// \return bool 配置更新成功返回true,否则返回false
        virtual bool UpdateConfig(const ITemporaryDimensionContext* pTemporaryDimensionContext) = 0;
    };
}



